<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:p="http://primefaces.org/ui"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:f="http://xmlns.jcp.org/jsf/core"
      xmlns:composite="http://java.sun.com/jsf/composite">

    <composite:interface>

        <composite:attribute name="enabledDisabled"/>
        <composite:attribute name="industryDisabled"/>    
        <composite:attribute name="nameDisabled"/> 
        <composite:attribute name="legalNameDisabled"/>
        <composite:attribute name="taxId1Disabled"/> 
        <composite:attribute name="taxId2Disabled"/> 
        <composite:attribute name="taxId3Disabled"/> 
        <composite:attribute name="webAddressDisabled"/>
        <composite:attribute name="alternateWebAddressDisabled"/>
        <composite:attribute name="emailAddressDisabled"/>
        <composite:attribute name="alternateEmailAddressDisabled"/>
        <composite:attribute name="telephoneNumberDisabled"/>
        <composite:attribute name="alternateTelephoneNumberDisabled"/>
        <composite:attribute name="additionalInfoDisabled"/>

        <composite:attribute name="industryRequired"/>    
        <composite:attribute name="nameRequired"/>

        <composite:attribute name="additionalInfoCounterRendered"/>

    </composite:interface>

    <p:tabView effect="fade">

        <p:tab title="#{bundle.Organization}">

            <h:panelGrid columns="3"
                         columnClasses="columnWidth48, columnWidth4, columnWidth48"
                         width="90%"
                         style="margin-left: auto; margin-right: auto">

                <h:panelGrid columns="1"
                             columnClasses="columnWidth100"
                             rowClasses="rowAlign"
                             width="100%">

                    <p:outputLabel value="#{bundle.Name}" 
                                   for="name"/>

                    <p:inputText id="name" 
                                 style="width: 100%; margin-bottom: 2%"
                                 value="#{organizationController.selected.name}"
                                 tabindex="01"
                                 disabled="#{cc.attrs.nameDisabled}"
                                 required="#{cc.attrs.nameRequired}"/> 

                    <p:outputLabel value="#{bundle.LegalName}" 
                                   for="legalName"/>

                    <p:inputText id="legalName" 
                                 style="width: 100%; margin-bottom: 2%"
                                 value="#{organizationController.selected.legalName}"
                                 tabindex="03"
                                 disabled="#{cc.attrs.legalNameDisabled}"/>

                    <p:outputLabel value="#{bundle.TaxId2}" 
                                   for="taxId2"/>

                    <p:inputText id="taxId2" 
                                 style="width: 100%; margin-bottom: 2%"
                                 value="#{organizationController.selected.taxId2}"
                                 tabindex="05"
                                 disabled="#{cc.attrs.taxId2Disabled}"/>      

                </h:panelGrid>    

                <p:spacer/>

                <h:panelGrid columns="1"
                             columnClasses="columnWidth100"
                             rowClasses="rowAlign"
                             width="100%">

                    <p:outputLabel value="#{bundle.Industry}"
                                   for="industry"/>

                    <p:selectOneMenu id="industry" 
                                     style="width: 100%; margin-bottom: 1.2%"                            
                                     value="#{organizationController.selected.industry}"
                                     tabindex="02"
                                     converter="industryConverter"
                                     effect="fade"
                                     filter="true"
                                     filterMatchMode="contains"
                                     disabled="#{cc.attrs.industryDisabled}"
                                     required="#{cc.attrs.industryRequired}">

                        <f:selectItem itemLabel="#{organizationController.selected.industry.nameWithDisabledFormatting}"
                                      itemValue="#{organizationController.selected.industry}"/>

                        <f:selectItems value="#{organizationController.selectIndustry}"
                                       var="item"
                                       itemLabel="#{item.label}"
                                       itemValue="#{item}"/>

                    </p:selectOneMenu>

                    <p:outputLabel value="#{bundle.TaxId1}" 
                                   for="taxId1"/>

                    <p:inputText id="taxId1" 
                                 style="width: 100%; margin-bottom: 2%"
                                 value="#{organizationController.selected.taxId1}"
                                 tabindex="04"
                                 disabled="#{cc.attrs.taxId1Disabled}"/> 

                    <p:outputLabel value="#{bundle.TaxId3}" 
                                   for="taxId1"/>

                    <p:inputText id="taxId3" 
                                 style="width: 100%; margin-bottom: 2%"
                                 value="#{organizationController.selected.taxId3}"
                                 tabindex="06"
                                 disabled="#{cc.attrs.taxId3Disabled}"/>       

                </h:panelGrid>    

            </h:panelGrid>         

        </p:tab>

        <p:tab title="#{bundle.ContactInfo}">

            <h:panelGrid columns="3"
                         columnClasses="columnWidth48, columnWidth4, columnWidth48"
                         width="90%"
                         style="margin-left: auto; margin-right: auto">

                <h:panelGrid columns="1"
                             columnClasses="columnWidth100"
                             rowClasses="rowAlign"
                             width="100%">      

                    <p:outputLabel value="#{bundle.TelephoneNumber}" 
                                   for="telephoneNumber"/>

                    <p:inputText id="telephoneNumber" 
                                 style="width: 100%; margin-bottom: 2%"
                                 value="#{organizationController.selected.telephoneNumber}"
                                 tabindex="07"
                                 disabled="#{cc.attrs.telephoneNumberDisabled}"/>         

                    <p:outputLabel value="#{bundle.EmailAddress}" 
                                   for="emailAddress"/>

                    <p:inputText id="emailAddress" 
                                 style="width: 100%; margin-bottom: 2%"
                                 value="#{organizationController.selected.emailAddress}"
                                 tabindex="09"
                                 disabled="#{cc.attrs.emailAddressDisabled}"/>     

                    <p:outputLabel value="#{bundle.WebAddress}" 
                                   for="webAddress"/>

                    <p:inputText id="webAddress" 
                                 style="width: 100%"
                                 value="#{organizationController.selected.webAddress}"
                                 tabindex="11"
                                 disabled="#{cc.attrs.webAddressDisabled}"/>        

                </h:panelGrid>    

                <p:spacer/>

                <h:panelGrid columns="1"
                             columnClasses="columnWidth100"
                             rowClasses="rowAlign"
                             width="100%">

                    <p:outputLabel value="#{bundle.AlternateTelephoneNumber}" 
                                   for="alternateTelephoneNumber"/>

                    <p:inputText id="alternateTelephoneNumber" 
                                 style="width: 100%; margin-bottom: 2%"
                                 value="#{organizationController.selected.alternateTelephoneNumber}"
                                 tabindex="08"
                                 disabled="#{cc.attrs.alternateTelephoneNumberDisabled}"/> 

                    <p:outputLabel value="#{bundle.AlternateEmailAddress}" 
                                   for="alternateEmailAddress"/>

                    <p:inputText id="alternateEmailAddress" 
                                 style="width: 100%; margin-bottom: 2%"
                                 value="#{organizationController.selected.alternateEmailAddress}"
                                 tabindex="10"
                                 disabled="#{cc.attrs.alternateEmailAddressDisabled}"/> 

                    <p:outputLabel value="#{bundle.AlternateWebAddress}" 
                                   for="alternateWebAddress"/>

                    <p:inputText id="alternateWebAddress" 
                                 style="width: 100%"
                                 value="#{organizationController.selected.alternateWebAddress}"
                                 tabindex="12"
                                 disabled="#{cc.attrs.alternateWebAddressDisabled}"/>         

                </h:panelGrid>    

            </h:panelGrid>             

        </p:tab>

        <p:tab title="#{bundle.AdditionalInfo}">

            <h:panelGrid columns="1"
                         columnClasses="columnWidth100"
                         width="90%"
                         style="margin-left: auto; margin-right: auto">            

                <p:outputLabel value="#{bundle.AdditionalInfo}" 
                               for="additionalInfo"/>

                <p:inputTextarea id="additionalInfo"
                                 style="width: 100%"
                                 value="#{organizationController.selected.additionalInfo}"
                                 tabindex="13"
                                 maxlength="256"
                                 counterTemplate="#{bundle.RemainingCharacters}: {0}"
                                 counter="additionalInfoCounter"                         
                                 disabled="#{cc.attrs.additionalInfoDisabled}"/>   

                <p:outputLabel id="additionalInfoCounter"
                               style="font-size: small"
                               rendered="#{cc.attrs.additionalInfoCounterRendered}"/>        

            </h:panelGrid>            

        </p:tab>

    </p:tabView>

    <p:dialog header="#{bundle.AdditionalInfo}"
              widgetVar="additionalInfoDialog" 
              resizable="false" 
              modal="true" 
              showEffect="fade"
              hideEffect="fade" 
              draggable="false"
              width="48%"
              style="margin-left: auto; margin-right: auto">

        <h:panelGrid columns="3"
                     columnClasses="columnWidth48, columnWidth4, columnWidth48"
                     width="90%"
                     style="margin-left: auto; margin-right: auto">

            <h:panelGrid columns="1"
                         columnClasses="columnWidth100"
                         rowClasses="rowAlign"
                         width="100%">

                <p:outputLabel value="#{bundle.Id}" 
                               for="id"/>

                <p:inputText id="id"
                             style="width: 100%; margin-bottom: 2%"
                             value="#{organizationController.selected.id}"
                             disabled="true"/>         

                <p:outputLabel value="#{bundle.CreatedBy}" 
                               for="createdBy"/>

                <p:inputText id="createdBy" 
                             style="width: 100%; margin-bottom: 2%"
                             value="#{organizationController.selected.createdBy.name}"
                             disabled="true"/>

                <p:outputLabel value="#{bundle.UpdatedBy}" 
                               for="updatedBy"/>

                <p:inputText id="updatedBy"   
                             style="width: 100%"
                             value="#{organizationController.selected.updatedBy.name}"
                             disabled="true"/>         

            </h:panelGrid>

            <p:spacer/>

            <h:panelGrid columns="1"
                         columnClasses="columnWidth100"
                         rowClasses="rowAlign"
                         width="100%">

                <p:outputLabel value="#{bundle.Enabled}"
                               for="enabled"/>

                <p:selectBooleanCheckbox id="enabled"
                                         style="vertical-align: -22%; margin-bottom: 4%"
                                         value="#{organizationController.selected.enabled}"
                                         disabled="#{cc.attrs.enabledDisabled}"/>        

                <p:outputLabel value="#{bundle.Created}" 
                               for="created"/>

                <p:inputText id="created"
                             style="width: 100%; margin-bottom: 2%"
                             value="#{organizationController.selected.created}"
                             disabled="true">

                    <f:convertDateTime 
                        locale="#{localizationUtil.selected}" 
                        type="both"
                        pattern="#{localizationUtil.dateTimeFormatMediumPattern}" 
                        timeZone="#{localizationUtil.defaultTimeZone}"/>      

                </p:inputText>  

                <p:outputLabel value="#{bundle.Updated}" 
                               for="updated"/>

                <p:inputText id="updated"
                             style="width: 100%"
                             value="#{organizationController.selected.updated}"
                             disabled="true">

                    <f:convertDateTime 
                        locale="#{localizationUtil.selected}" 
                        type="both"
                        pattern="#{localizationUtil.dateTimeFormatMediumPattern}" 
                        timeZone="#{localizationUtil.defaultTimeZone}"/>

                </p:inputText>         

            </h:panelGrid>    

        </h:panelGrid>

    </p:dialog>   

</html>